/*     */ package com.zimbra.cs.util.tnef.mapi;
/*     */ 
/*     */ import com.zimbra.cs.util.tnef.IcalUtil;
/*     */ import com.zimbra.cs.util.tnef.MSGUID;
/*     */ import com.zimbra.cs.util.tnef.SchedulingViewOfTnef;
/*     */ import java.io.IOException;
/*     */ import java.util.Date;
/*     */ import java.util.List;
/*     */ import net.fortuna.ical4j.model.DateTime;
/*     */ import net.freeutils.tnef.Attr;
/*     */ import net.freeutils.tnef.MAPIProp;
/*     */ import net.freeutils.tnef.MAPIPropName;
/*     */ import net.freeutils.tnef.MAPIProps;
/*     */ import net.freeutils.tnef.MAPIValue;
/*     */ import net.freeutils.tnef.RawInputStream;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class MapiPropertyId
/*     */ {
/*  38 */   public static final MapiPropertyId PidTagImportance = new MapiPropertyId(23);
/*     */   
/*  40 */   public static final MapiPropertyId PidTagSensitivity = new MapiPropertyId(54);
/*     */   
/*  42 */   public static final MapiPropertyId PidTagResponseRequested = new MapiPropertyId(99);
/*     */   
/*  44 */   public static final MapiPropertyId PidTagReplyRequested = new MapiPropertyId(3095);
/*     */   
/*  46 */   public static final MapiPropertyId PidTagOwnerAppointmentId = new MapiPropertyId(98);
/*     */   
/*  48 */   public static final MapiPropertyId PidTagEndDate = new MapiPropertyId(97);
/*     */   
/*  50 */   public static final MapiPropertyId PidTagStartDate = new MapiPropertyId(96);
/*     */   
/*  52 */   public static final MapiPropertyId PidTagCreationTime = new MapiPropertyId(12295);
/*     */   
/*  54 */   public static final MapiPropertyId PidTagLastModificationTime = new MapiPropertyId(12296);
/*     */   
/*  56 */   public static final MapiPropertyId PidTagRtfCompressed = new MapiPropertyId(4105);
/*     */   
/*  58 */   public static final MapiPropertyId PidLidReminderDelta = new MapiPropertyId(MSGUID.PSETID_Common, 34049L);
/*     */   
/*  60 */   public static final MapiPropertyId PidLidReminderSet = new MapiPropertyId(MSGUID.PSETID_Common, 34051L);
/*     */   
/*  62 */   public static final MapiPropertyId PidLidCommonStart = new MapiPropertyId(MSGUID.PSETID_Common, 34070L);
/*     */   
/*  64 */   public static final MapiPropertyId PidLidCommonEnd = new MapiPropertyId(MSGUID.PSETID_Common, 34071L);
/*     */   
/*  66 */   public static final MapiPropertyId PidLidTaskMode = new MapiPropertyId(MSGUID.PSETID_Common, 34072L);
/*     */   
/*  68 */   public static final MapiPropertyId PidLidTaskGlobalId = new MapiPropertyId(MSGUID.PSETID_Common, 34073L);
/*     */   
/*  70 */   public static final MapiPropertyId PidLidMileage = new MapiPropertyId(MSGUID.PSETID_Common, 34100L);
/*     */   
/*  72 */   public static final MapiPropertyId PidLidBilling = new MapiPropertyId(MSGUID.PSETID_Common, 34101L);
/*     */   
/*  74 */   public static final MapiPropertyId PidLidCompanies = new MapiPropertyId(MSGUID.PSETID_Common, 34105L);
/*     */   
/*  76 */   public static final MapiPropertyId PidNameKeywords = new MapiPropertyId(MSGUID.PS_PUBLIC_STRINGS, "Keywords");
/*     */   
/*  78 */   public static final MapiPropertyId PidNameCalendarUid = new MapiPropertyId(MSGUID.PS_PUBLIC_STRINGS, "urn:schemas:calendar:uid");
/*     */   
/*     */ 
/*  81 */   public static final MapiPropertyId PidLidAppointmentSequence = new MapiPropertyId(MSGUID.PSETID_Appointment, 33281L);
/*     */   
/*  83 */   public static final MapiPropertyId PidLidAppointmentStartWhole = new MapiPropertyId(MSGUID.PSETID_Appointment, 33293L);
/*     */   
/*  85 */   public static final MapiPropertyId PidLidAppointmentEndWhole = new MapiPropertyId(MSGUID.PSETID_Appointment, 33294L);
/*     */   
/*  87 */   public static final MapiPropertyId PidLidAppointmentSubType = new MapiPropertyId(MSGUID.PSETID_Appointment, 33301L);
/*     */   
/*  89 */   public static final MapiPropertyId PidLidAppointmentRecur = new MapiPropertyId(MSGUID.PSETID_Appointment, 33302L);
/*     */   
/*  91 */   public static final MapiPropertyId PidLidAppointmentStateFlags = new MapiPropertyId(MSGUID.PSETID_Appointment, 33303L);
/*     */   
/*  93 */   public static final MapiPropertyId PidLidBusyStatus = new MapiPropertyId(MSGUID.PSETID_Appointment, 33285L);
/*     */   
/*  95 */   public static final MapiPropertyId PidLidLocation = new MapiPropertyId(MSGUID.PSETID_Appointment, 33288L);
/*     */   
/*  97 */   public static final MapiPropertyId PidLidAppointmentReplyTime = new MapiPropertyId(MSGUID.PSETID_Appointment, 33312L);
/*     */   
/*  99 */   public static final MapiPropertyId PidLidIntendedBusyStatus = new MapiPropertyId(MSGUID.PSETID_Appointment, 33316L);
/*     */   
/* 101 */   public static final MapiPropertyId PidLidExceptionReplaceTime = new MapiPropertyId(MSGUID.PSETID_Appointment, 33320L);
/*     */   
/* 103 */   public static final MapiPropertyId PidLidTimeZoneDescription = new MapiPropertyId(MSGUID.PSETID_Appointment, 33332L);
/*     */   
/* 105 */   public static final MapiPropertyId PidLidAppointmentProposedStartWhole = new MapiPropertyId(MSGUID.PSETID_Appointment, 33360L);
/*     */   
/* 107 */   public static final MapiPropertyId PidLidAppointmentProposedEndWhole = new MapiPropertyId(MSGUID.PSETID_Appointment, 33361L);
/*     */   
/* 109 */   public static final MapiPropertyId PidLidAppointmentCounterProposal = new MapiPropertyId(MSGUID.PSETID_Appointment, 33367L);
/*     */   
/* 111 */   public static final MapiPropertyId PidLidAppointmentNotAllowPropose = new MapiPropertyId(MSGUID.PSETID_Appointment, 33370L);
/*     */   
/*     */ 
/*     */ 
/*     */ 
/* 116 */   public static final MapiPropertyId PidLidAppointmentTimeZoneDefinitionStartDisplay = new MapiPropertyId(MSGUID.PSETID_Appointment, 33374L);
/*     */   
/*     */ 
/*     */ 
/*     */ 
/* 121 */   public static final MapiPropertyId PidLidAppointmentTimeZoneDefinitionEndDisplay = new MapiPropertyId(MSGUID.PSETID_Appointment, 33375L);
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/* 130 */   public static final MapiPropertyId PidLidAppointmentTimeZoneDefinitionRecur = new MapiPropertyId(MSGUID.PSETID_Appointment, 33376L);
/*     */   
/* 132 */   public static final MapiPropertyId PidLidTimeZoneStruct = new MapiPropertyId(MSGUID.PSETID_Appointment, 33331L);
/*     */   
/* 134 */   public static final MapiPropertyId PidLidAttendeeCriticalChange = new MapiPropertyId(MSGUID.PSETID_Meeting, 1L);
/*     */   
/* 136 */   public static final MapiPropertyId PidLidGlobalObjectId = new MapiPropertyId(MSGUID.PSETID_Meeting, 3L);
/*     */   
/* 138 */   public static final MapiPropertyId PidLidOwnerCriticalChange = new MapiPropertyId(MSGUID.PSETID_Meeting, 26L);
/*     */   
/* 140 */   public static final MapiPropertyId PidLidCleanGlobalObjectId = new MapiPropertyId(MSGUID.PSETID_Meeting, 35L);
/*     */   
/* 142 */   public static final MapiPropertyId PidLidMeetingType = new MapiPropertyId(MSGUID.PSETID_Meeting, 38L);
/*     */   
/* 144 */   public static final MapiPropertyId PidLidStartRecurrenceTime = new MapiPropertyId(MSGUID.PSETID_Meeting, 14L);
/*     */   
/*     */ 
/*     */ 
/* 148 */   public static final MapiPropertyId PidLidTaskStatus = new MapiPropertyId(MSGUID.PSETID_Task, 33025L);
/*     */   
/*     */ 
/* 151 */   public static final MapiPropertyId PidLidPercentComplete = new MapiPropertyId(MSGUID.PSETID_Task, 33026L);
/*     */   
/*     */ 
/*     */ 
/* 155 */   public static final MapiPropertyId PidLidTaskStartDate = new MapiPropertyId(MSGUID.PSETID_Task, 33028L);
/*     */   
/*     */ 
/*     */ 
/* 159 */   public static final MapiPropertyId PidLidTaskDueDate = new MapiPropertyId(MSGUID.PSETID_Task, 33029L);
/*     */   
/*     */ 
/*     */ 
/* 163 */   public static final MapiPropertyId PidLidTaskDateCompleted = new MapiPropertyId(MSGUID.PSETID_Task, 33039L);
/*     */   
/*     */ 
/* 166 */   public static final MapiPropertyId PidLidTaskActualEffort = new MapiPropertyId(MSGUID.PSETID_Task, 33040L);
/*     */   
/*     */ 
/* 169 */   public static final MapiPropertyId PidLidTaskEstimatedEffort = new MapiPropertyId(MSGUID.PSETID_Task, 33041L);
/*     */   
/* 171 */   public static final MapiPropertyId PidLidTaskVersion = new MapiPropertyId(MSGUID.PSETID_Task, 33042L);
/*     */   
/*     */ 
/*     */ 
/*     */ 
/* 176 */   public static final MapiPropertyId PidLidTaskRecurrence = new MapiPropertyId(MSGUID.PSETID_Task, 33046L);
/*     */   
/*     */ 
/*     */ 
/* 180 */   public static final MapiPropertyId PidLidTaskStatusOnComplete = new MapiPropertyId(MSGUID.PSETID_Task, 33049L);
/*     */   
/*     */ 
/*     */ 
/*     */ 
/* 185 */   public static final MapiPropertyId PidLidTaskComplete = new MapiPropertyId(MSGUID.PSETID_Task, 33052L);
/*     */   
/*     */ 
/*     */ 
/*     */   private MAPIPropName mapiPropName;
/*     */   
/*     */ 
/*     */ 
/*     */   private int id;
/*     */   
/*     */ 
/*     */ 
/*     */   private MapiPropertyId(MSGUID msg, long lid)
/*     */   {
/* 199 */     this.mapiPropName = new MAPIPropName(msg.getJtnefGuid(), lid);
/* 200 */     this.id = 0;
/*     */   }
/*     */   
/*     */   private MapiPropertyId(MSGUID msg, String propNameId) {
/* 204 */     this.mapiPropName = new MAPIPropName(msg.getJtnefGuid(), propNameId);
/* 205 */     this.id = 0;
/*     */   }
/*     */   
/*     */   private MapiPropertyId(int id) {
/* 209 */     this.mapiPropName = null;
/* 210 */     this.id = id;
/*     */   }
/*     */   
/*     */   public String toString()
/*     */   {
/* 215 */     if (this.mapiPropName == null) {
/* 216 */       return this.mapiPropName.toString();
/*     */     }
/* 218 */     return "ID=" + this.id;
/*     */   }
/*     */   
/*     */   public String getStringValue(SchedulingViewOfTnef schedView) throws IOException
/*     */   {
/* 223 */     MAPIValue mpValue = getFirstValue(schedView);
/* 224 */     if (mpValue == null) {
/* 225 */       return null;
/*     */     }
/*     */     
/* 228 */     if (mpValue.getType() == 30)
/*     */     {
/*     */ 
/* 231 */       RawInputStream ris = mpValue.getRawData();
/* 232 */       return IcalUtil.readString(ris, (int)ris.getLength(), schedView.getOEMCodePage());
/*     */     }
/*     */     
/*     */ 
/*     */ 
/* 237 */     Object obj = mpValue.getValue();
/*     */     
/* 239 */     if (obj == null) {
/* 240 */       return null;
/*     */     }
/* 242 */     if ((obj instanceof String)) {
/* 243 */       return (String)obj;
/*     */     }
/* 245 */     return null;
/*     */   }
/*     */   
/*     */   public Boolean getBooleanValue(SchedulingViewOfTnef schedView, boolean defaultValue) throws IOException {
/* 249 */     Boolean truthValue = getBooleanValue(schedView);
/* 250 */     if (truthValue == null) {
/* 251 */       truthValue = new Boolean(defaultValue);
/*     */     }
/* 253 */     return truthValue;
/*     */   }
/*     */   
/*     */   public Boolean getBooleanValue(SchedulingViewOfTnef schedView) throws IOException {
/* 257 */     MAPIValue mpValue = getFirstValue(schedView);
/* 258 */     if (mpValue == null) {
/* 259 */       return null;
/*     */     }
/* 261 */     Object obj = mpValue.getValue();
/* 262 */     if (obj == null) {
/* 263 */       return null;
/*     */     }
/* 265 */     if ((obj instanceof Boolean)) {
/* 266 */       return (Boolean)obj;
/*     */     }
/* 268 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Integer getIntegerValue(SchedulingViewOfTnef schedView, int defaultVal)
/*     */     throws IOException
/*     */   {
/* 281 */     Integer retVal = getIntegerValue(schedView);
/* 282 */     if (retVal == null) {
/* 283 */       retVal = Integer.valueOf(defaultVal);
/*     */     }
/* 285 */     return retVal;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Integer getIntegerValue(SchedulingViewOfTnef schedView)
/*     */     throws IOException
/*     */   {
/* 297 */     MAPIValue mpValue = getFirstValue(schedView);
/* 298 */     if (mpValue == null) {
/* 299 */       return null;
/*     */     }
/* 301 */     Object obj = mpValue.getValue();
/* 302 */     if (obj == null) {
/* 303 */       return null;
/*     */     }
/* 305 */     if ((obj instanceof Integer)) {
/* 306 */       return (Integer)obj;
/*     */     }
/* 308 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Double getDoubleValue(SchedulingViewOfTnef schedView)
/*     */     throws IOException
/*     */   {
/* 320 */     MAPIValue mpValue = getFirstValue(schedView);
/* 321 */     if (mpValue == null) {
/* 322 */       return null;
/*     */     }
/* 324 */     Object obj = mpValue.getValue();
/* 325 */     if (obj == null) {
/* 326 */       return null;
/*     */     }
/* 328 */     if ((obj instanceof Double)) {
/* 329 */       return (Double)obj;
/*     */     }
/* 331 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public DateTime getDateTimeAsUTC(SchedulingViewOfTnef schedView)
/*     */     throws IOException
/*     */   {
/* 346 */     Date javaDate = getDateValue(schedView);
/* 347 */     if (javaDate == null) {
/* 348 */       return null;
/*     */     }
/* 350 */     DateTime icalDateTime = new DateTime(javaDate);
/* 351 */     icalDateTime.setUtc(true);
/* 352 */     return icalDateTime;
/*     */   }
/*     */   
/*     */   public Date getDateValue(SchedulingViewOfTnef schedView) throws IOException {
/* 356 */     MAPIValue mpValue = getFirstValue(schedView);
/* 357 */     if (mpValue == null) {
/* 358 */       return null;
/*     */     }
/* 360 */     Object obj = mpValue.getValue();
/* 361 */     if (obj == null) {
/* 362 */       return null;
/*     */     }
/* 364 */     if ((obj instanceof Date)) {
/* 365 */       return (Date)obj;
/*     */     }
/* 367 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public Long get100nsPeriodsSince1601(SchedulingViewOfTnef schedView)
/*     */     throws IOException
/*     */   {
/* 378 */     RawInputStream ris = getRawInputStreamValue(schedView);
/* 379 */     if (ris == null) {
/* 380 */       return null;
/*     */     }
/* 382 */     if (ris.getLength() != 8L) {
/* 383 */       return null;
/*     */     }
/*     */     
/* 386 */     return Long.valueOf(ris.readU64());
/*     */   }
/*     */   
/*     */   public RawInputStream getRawInputStreamValue(SchedulingViewOfTnef schedView) throws IOException {
/* 390 */     MAPIValue mpValue = getFirstValue(schedView);
/* 391 */     if (mpValue == null) {
/* 392 */       return null;
/*     */     }
/* 394 */     return mpValue.getRawData();
/*     */   }
/*     */   
/*     */   public byte[] getByteArrayValue(SchedulingViewOfTnef schedView) throws IOException {
/* 398 */     MAPIValue mpValue = getFirstValue(schedView);
/* 399 */     if (mpValue == null) {
/* 400 */       return null;
/*     */     }
/* 402 */     Object obj = mpValue.getValue();
/* 403 */     if (obj == null) {
/* 404 */       return null;
/*     */     }
/* 406 */     if ((obj instanceof byte[]))
/* 407 */       return (byte[])obj;
/* 408 */     if ((obj instanceof RawInputStream)) {
/* 409 */       RawInputStream ris = (RawInputStream)obj;
/* 410 */       return ris.toByteArray();
/*     */     }
/* 412 */     return null;
/*     */   }
/*     */   
/*     */   public MAPIValue getFirstValue(SchedulingViewOfTnef schedView) throws IOException {
/* 416 */     MAPIValue[] mpValues = getValues(schedView);
/* 417 */     if (mpValues == null) {
/* 418 */       return null;
/*     */     }
/* 420 */     if (mpValues.length < 1) {
/* 421 */       return null;
/*     */     }
/* 423 */     return mpValues[0];
/*     */   }
/*     */   
/*     */   public MAPIValue[] getValues(SchedulingViewOfTnef schedView) throws IOException {
/* 427 */     MAPIProp mp = getProp(schedView);
/* 428 */     if (mp == null) {
/* 429 */       return null;
/*     */     }
/* 431 */     return mp.getValues();
/*     */   }
/*     */   
/*     */   public MAPIProp getProp(SchedulingViewOfTnef schedView) throws IOException
/*     */   {
/* 436 */     List<?> attribs = schedView.getAttributes();
/* 437 */     for (Object thisObj : attribs)
/* 438 */       if ((thisObj instanceof Attr))
/*     */       {
/*     */ 
/* 441 */         Attr thisAtt = (Attr)thisObj;
/* 442 */         Object o = thisAtt.getValue();
/* 443 */         if ((o != null) && 
/*     */         
/*     */ 
/* 446 */           (thisAtt.getID() == 36867))
/*     */         {
/*     */ 
/* 449 */           if (!(o instanceof MAPIProps)) {
/* 450 */             return null;
/*     */           }
/* 452 */           MAPIProps thisPropset = (MAPIProps)o;
/* 453 */           MAPIProp mp; MAPIProp mp; if (this.mapiPropName == null) {
/* 454 */             mp = thisPropset.getProp(this.id);
/*     */           } else {
/* 456 */             mp = thisPropset.getProp(this.mapiPropName);
/*     */           }
/* 458 */           if (mp != null)
/* 459 */             return mp;
/*     */         }
/*     */       }
/* 462 */     return null;
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/util/tnef/mapi/MapiPropertyId.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */